/**
 * user表操作 
 */
var User = {
    // 获取所有
    queryAllUser: function(param) {
        return "select * from user";
    },
    // 获取未分班学生
    queryAllStu: function(param) {
        return "select * from user a where a.TYPE=1 and a.ID not in (select uid from bu)";
    },
    // 查询用户名
    queryUserName: function(param) {
        return "select * from user where XNUM = '" + param.user + "'";
    },
    // 根据ID查询
    queryUserByID: function(param) {
        return "select * from user where ID = '" + param.ID + "'";
    },
    // 验证用户名密码
    queryUNP: function(param) {
        return "select * from user where XNUM = '" + param.user + "' and PASSWORD = '" + param.pwd + "' limit 1";
    },
    // 增加数据  
    insertData: function(param) {
        return "INSERT INTO user (USERNAME,PASSWORD,HEADPORTRAIT,ADDTIME,EDITTIME,TYPE,COLLEAGE,XNUM) VALUES ('" + param.user + "','" + param.pwd + "','" + param.headimg + "','" + param.addtime + "','" + param.edittime + "','" + param.type+ "','" + param.colleage+ "','" + param.xnum +"')";
    },
    //删除用户
    delUser: function(param) {
        return "DELETE from user where ID = " + param.ID;    
    },
    //更新用户
    updateUser:function(param){
        return "UPDATE user SET USERNAME = '"+param.name+"'"+' , '+"PASSWORD = '"+param.pwd+"'"+' , '+"EDITTIME = '"+param.edittiem+"'"+' , '+"COLLEAGE='"+param.colleage+"'"+' , '+"XNUM='"+param.xum+"'"+" WHERE ID = '"+param.ID+"'";
    },
    //修改密码
    changePass:function(param){
        return "UPDATE user SET PASSWORD = '"+param.pwd+"'"+" WHERE ID = '"+param.ID+"'";
    }
}
exports = module.exports = User;